refactor(cli): add supervisor control and process adapters#504
Open
xiami762 wants to merge 30 commits into
Open
refactor(cli): add supervisor control and process adapters#504xiami762 wants to merge 30 commits into
xiami762 wants to merge 30 commits into
Conversation
added 30 commits
July 1, 2026 17:09
…ters' into refactor/supervisor-control-adapters
…ntrol-adapters # Conflicts: # flocks/storage/storage.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Key Changes
/api/healthfailures.flocks/cli/service_control.pytyped control operations for status, stop, restart, WebUI stop/restart, and logs.flocks/cli/service_config.pyas the single owner for service config defaults, CLI/env merge, and control payload serialization.flocks/cli/service_process.pybackend/WebUI process adapters so supervisor policy is separated from process start/stop/probe implementation.read_control_json/post_control_jsonusage from CLI/updater callers.Impact Scope
flocks start/status/stop/restart/logsnow operate through the supervisor control plane. Backend and WebUI are restarted by the supervisor when they exit or lose their listener.Business Logic to Review
flocks/cli/service_supervisor.py: restart policy, pause behavior for upgrade handoff, health failure threshold, and process-group shutdown ordering.flocks/cli/service_control.py: typed control API mapping and status parsing.flocks/cli/service_config.py: config serialization/deserialization and CLI/env/default precedence.flocks/cli/service_process.py: backend/WebUI probe semantics for process exit, listener loss, and backend/api/healthfailures.flocks/updater/updater.py: WebUI stop/restart during upgrade handoff and rollback recovery.Why This Approach
Test Plan
uv run pytest tests/updater/test_updater.py tests/cli/test_service_manager.py tests/cli/test_service_commands.pyuv run ruff check flocks/cli/service_config.py flocks/cli/service_control.py flocks/cli/service_process.py flocks/cli/service_supervisor.py flocks/cli/service_manager.py flocks/cli/main.py flocks/updater/updater.py tests/cli/test_service_manager.py tests/cli/test_service_commands.py tests/updater/test_updater.pygit diff --checkCompatibility, Migration & Rollback